﻿using System.Web;

namespace Infrastructure.Storage
{
    public class HttpContextStorageAdapter : IHttpContextStorage
    {
        public void Add(string key, object data)
        {
            HttpContext.Current.Items.Add(key, data);
        }

        public void Remove(string key)
        {
            HttpContext.Current.Items.Remove(key);
        }

        public T Get<T>(string key) where T : class
        {
            return (T) HttpContext.Current.Items[key];
        }
    }
}